﻿<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport"
	content="width=device-width, initial-scale=1, maximum-scale=1">
<title>控制台</title>
<link rel="stylesheet" href="st/css/layui.css">
<script src="st/json.js"></script>

</head>
<body class="layui-layout-body">
	<div class="layui-layout">

		<div class="layui-side layui-bg-black">
			<div class="layui-side-scroll">
				<!-- 左侧导航区域（可配合layui已有的垂直导航） -->
				<ul class="layui-nav layui-nav-tree" lay-filter="test">
					<li class="layui-nav-item layui-nav-itemed"><a class=""
						href="javascript:;">控制台</a>
						<dl class="layui-nav-child">
							<dd class="layui-this">
								<a data-id='console1' id="single_console1" href="javascript:;">智能工卡管理系统</a>
							</dd>
							<dd>
								<a data-id='console2' id="single_console2" href="javascript:;">智慧交通部标平台</a>
							</dd>
<!-- 							<dd> -->
<!-- 								<a data-id='console2' id="multi_console" href="javascript:;">所有</a> -->
<!-- 							</dd> -->
						</dl></li>
				</ul>
			</div>
		</div>
		<div class="layui-body">
			<div id="single">
				<iframe id="console1" src="http://workcard.hoinnet.com/workcard/index.html" style="display:none;width:100%;height:850px;"></iframe>
				<iframe id="console2" src="http://wx.shltsw.com/808gps/login.html" style="display:none;width:100%;height:850px;"></iframe>
			</div>
			<div id="multi" style="display:none;">
<!-- 				<div style='float:left;width:50%;'><iframe src="http://218.93.5.74:99/czxhttcard" style="width:100%;height:1000px;"></iframe></div> -->
<!-- 				<div style='float:right;width:50%'><iframe src="http://119.23.22.86/808gps/login.html" style="width:100%;height:1000px;"></iframe></div> -->
			</div>
		</div>

	</div>
	<script src="st/jquery.min.js"></script>
	<script src="st/layui.all.js"></script>
	<script>
	$(function() {
		
		$("#console1").show();
		$("#console2").hide();
		
		$("#single_console1, #single_console2").click(function() {
			$("#multi").hide();
			$("#single").show();
			var id = $(this).attr('data-id');
			$("#single iframe").hide();
			$("#" + id).show();
		});
		$("#multi_console").click(function() {
			$("#single").hide();
			$("#multi").show();
		});
		
		 var iframe = document.getElementById("console2");
		 if (iframe.attachEvent) {    
            iframe.attachEvent("onload", function() {    
            	loadFrame();
            });
        } else {    
            iframe.onload = function() {    
            	loadFrame();
            };    
        }    
	});
	
	function loadFrame() {
		setTimeout(function() {
		
			if(typeof lang == "undefined") {
				var tempFrame = document.getElementById("console2").contentWindow;
			//alert(tempFrame.companys);
				lang = temp_lang;
				//lang = tempFrame.lang;
				
			} else {
				lang = undefined;
			}
		}, 3000);
		
		var tempFrame = document.getElementById("console2").contentWindow;
		var interval = setInterval(function() {
			
			if(tempFrame.companyId != null &&tempFrame.companyId != 'undefined' && tempFrame.companyId != undefined) {
			
				jQuery.each(tempFrame, function(i, val) {
					if(window[i] == null || window[i] == 'undefined' || window[i] == undefined) {
						if(i != 'lang') {
							window[i] = val;
						}
					}
				});
				clearInterval(interval);
			}
		},1000);
	}
	</script>
</body>
</html>